In computing, a process is a running instance of a program, including all variables and state information. A modern computer operating system typically supports many processes, which are multitasked to give the appearance that the process can run simultaneously. Processes are often called tasks. Processes may execute on one or more computers connected by a network. The operating system identifies each process by its process identifier (PID). Once a process is created, its PID may be transmitted to other processes.
A parent process is a process that has created one or more child processes. A child process is a process created by another process (i.e., the parent process). For example, in UNIX, a process may be created when another process executes the fork system call. In such an example, the process that invoked the fork system call is the parent process and the newly-created process is the child process. Every process (except, for example, process 0 in UNIX) has only one parent process, but may have many child processes.
In a multitasking computer system, processes may occupy a variety of states. These distinct states may not actually be recognized as such by the operating system, however they are a useful abstraction for the understanding of processes. Described below are typical process states that are possible on computer systems of all kinds.
When a process is first created, it occupies the “created” or “new” state. In this state, the process awaits admission to the “waiting” or “ready” state. A “waiting” process denotes a process that has been loaded into main memory and is awaiting execution on a CPU. For example, in a one processor system, only one process can be executing at any one time, and all other “concurrently executing” processes will be waiting for execution.
A “running,” “executing,” or “active” process denotes a process which is currently executing on a CPU. From this state, the process may exceed its allocated time slice and be context switched out and back to a “waiting” state by the operating system, it may indicate that it has finished and be terminated, or it may block on some needed resource (such as an input/output resource) and be moved to a “sleeping” or “blocked” state. The process will remain “sleeping” until its resource becomes available. Once the operating system is aware that a process is no longer blocking, the process is again “ready” and can from there be dispatched to its “running” state. At this point, the process may make use of its newly available resource.
A process may be terminated, either from the “running” state by completing its execution or by explicitly being killed. In either of these cases, the process moves to the “terminated” or “dead” state. A process in the “created” or “terminated” state may not be present in the main memory of the computer system.
Message passing or any sort of delivery of a message, is a form of communication used in various sorts of programming methods, including concurrent programming, parallel programming, object-oriented programming, interprocess communication, and other application that requires communication. Communication is performed by the sending of messages to recipients. Forms of messages may include function invocation, signals, data packets, and the like. Messages may be delivered from a sender process to a receiver process by first obtaining the PID of the receiver process. The receiver process may not be able to receive the message if the process is not present in the main memory, e.g., if the receiving process is not yet started by its parent or if the receiving process is terminated already. The sender process may be waiting in a loop for the receiver process to be able to receive message or acknowledge the receipt of the message. A common technique known in the art is to implement a message buffer to allow the sender process to continue executing without waiting for the receiver process. If an error condition eventually occurs, the message may then be handled without wasting processing cycles in a wait loop.